import { request } from 'umi';

/** 获取马达自身报警GET /api/log */
export async function queryDeviceAlarm(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
     /** 设备id */
    deviceId?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/sys/device/alarm', {
  
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}



/** 添加系统驱动 POST /api//sys/device/alarm */
export async function addDeviceAlarm(body: API.SysDeviceAlarm, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/sys/device/alarm', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}



/** 更新自身报警PUT /api/alarm/handle */
export async function updateDeviceAlarm(body: API.SysDeviceAlarm, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/sys/device/alarm', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}



/** 删除自身报警DELETE /api/deviceAlarmRecord/batchdel */
export async function removeDeviceAlarm(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/sys/device/alarm', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}


/** 批量删除自身报警DELETE /api/deviceAlarmRecord/batchdel */
export async function batchRemoveDeviceAlarm(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/sys/device/alarm/batchdel', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}






/** 批量更新设备UseState POST /api/device */
export async function batchUpdateDeviceAlarm(body: object, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/sys/device/alarm/batchUpdate', {
    method: 'POST',
    requestType: 'form',
    data: body,
    ...(options || {}),
  });
}
